/*
 * @Author: zhangyang
 * @Date: 2023-12-29 10:15:53
 * @LastEditTime: 2024-01-09 11:02:44
 * @Description: 
 */

import { BatchInterceptor } from '@mswjs/interceptors'
// @ts-ignore
import browserInterceptors from '@mswjs/interceptors/presets/browser'

const interceptor = new BatchInterceptor({
  name: 'my-interceptor',
  interceptors: browserInterceptors,
})

interceptor.apply()

interceptor.on('response', async ({ response, isMockedResponse, request, requestId }) => {
  // console.log("🚀 ~ file: main.ts:19 ~ interceptor.on ~ requestId:", requestId)
  // console.log("🚀 ~ file: main.ts:19 ~ interceptor.on ~ request:", request)
  // console.log("🚀 ~ file: main.ts:19 ~ interceptor.on ~ isMockedResponse:", isMockedResponse)
  // react to the incoming response...
  // console.log("🚀 ~ file: main.ts:20 ~ interceptor.on ~ response:", response)

  const res = await response.json()
  console.log("🚀 ~ file: main.ts:27 ~ interceptor.on ~ res:", res)
})